package cn.smxy.client;

import cn.smxy.param.CollegeDetailParam;
import cn.smxy.param.CollegePlantPageParam;
import cn.smxy.param.CollegeSearchParam;
import cn.smxy.param.PageParam;
import cn.smxy.pojo.College;
import cn.smxy.pojo.CollegePlant;
import cn.smxy.util.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@FeignClient(value = "college-service",path = "college")
public interface CollegeClient {
    /**
     * 查询学校详情接口(查询学号校验方法)
     * @param collegeDetailParam 高校名称
     * @return 高校详情
     */
    @PostMapping("/detail")
    R detail(@RequestBody CollegeDetailParam collegeDetailParam);

    /**
     * 保存校园植物作品接口
     * @param collegePlant
     * @return
     */
    @PostMapping("/plant/save")
    R save(@RequestBody CollegePlant collegePlant);

    /**
     * 分页展示学校接口
     * @param collegeSearchParam 分页参数
     * @return
     */
    @PostMapping("/page")
    R page(@RequestBody CollegeSearchParam collegeSearchParam);

    /**
     * 添加新学校接口
     * @param college
     * @return
     */
    @PostMapping("/save")
    R save(@RequestBody College college);

    /**
     * 展示所有学校接口
     * @return
     */
    @GetMapping("/list")
    R list();

    /**
     * 删除学校接口
     * @param collegeId
     * @return
     */
    @DeleteMapping("/remove/{collegeId}")
    R remove(@PathVariable("collegeId") Long collegeId);

    /**
     * 修改学校信息接口
     * @param college
     * @return
     */
    @PutMapping("/update")
    R update(@RequestBody College college);

    /**
     * 删除校园植物接口
     * @param plantId
     * @return
     */
    @DeleteMapping("/plant/remove/{plantId}")
    R removePlant(@PathVariable Long plantId);

    /**
     * 分页展示校园植物接口
     * @param collegePlantPageParam
     * @return
     */
    @PostMapping("/plant/page")
    R plantPage(@RequestBody CollegePlantPageParam collegePlantPageParam);

    /**
     * 删除用户对应的校园植物接口
     * @param userId
     * @return
     */
    @DeleteMapping("/plant/remove/user/{userId}")
    R removeByUserId(@PathVariable Long userId);
}
